﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;

namespace CoreVirtuoso.Helpers
{
   public class ConnectionStringsHelper
   {
      private static string _virtuosoConnectionString = null;

      public static string GetVirtuosoConnectionString()
      {
         if (_virtuosoConnectionString != null)
            return _virtuosoConnectionString;

         ConnectionStringSettings connectionStringSettings =
            ConfigurationManager.ConnectionStrings["VirtuosoConnectionString"];
         if (connectionStringSettings == null)
            throw new Exception("VirtuosoConnectionString should be set in config");

         string virtuosoConnectionString = connectionStringSettings.ConnectionString;
         if (String.IsNullOrEmpty(virtuosoConnectionString))
            throw new Exception("VirtuosoConnectionString shouldn't be null or empty");

         return virtuosoConnectionString;
      }

      public static Uri GetLinkedGeoDataSparqlEndPointUri()
      {
         return new Uri("http://linkedgeodata.org/sparql/");
      }
   }
}